package org.smr.ministore.micro.client;

import java.util.List;

import org.blade.utils.Pager;
import org.smr.ministore.entities.Authority;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value="auth.Authority",/*fallback = HystrixClientFallback.class, */fallbackFactory = HystrixAuthorityClientFactory.class)
public interface FeignAuthorityMicroServiceClient {

    @RequestMapping(method = RequestMethod.POST, value = "/Authority/batchSave")
    int batchSave(@RequestBody List< Authority> entities);

    @RequestMapping(method = RequestMethod.PUT, value = "/Authority/save")
    public int save(@RequestBody Authority entity) ;

    @RequestMapping(method = RequestMethod.PATCH, value = "/Authority/updateById")
    public int updateById(@RequestBody Authority id);

    @RequestMapping(method = RequestMethod.GET, value = "/Authority/queryById/{id}")
    public  Authority queryById(@PathVariable("id")Long id);

    @RequestMapping(method = RequestMethod.DELETE, value = "/Authority/deleteById/{id}")
    public int deleteById(@PathVariable("id")Long id);

    @RequestMapping(method = RequestMethod.POST, value = "/Authority/paginate/{pageSize}/{pageNum}")
    public Pager<Authority> paginate( @RequestBody Authority entity,  @PathVariable("pageSize")Long pageSize,  @PathVariable("pageNum")Long pageNum );

    @RequestMapping( method = RequestMethod.POST, value = "/Authority/getByParentAndType/{parentId}/{type}")
    public List<Authority> getByParentAndType( @PathVariable("parentId")Long parentId,  @PathVariable("type")Integer type);
}
